Skip to content

Conversation

@khiga8
Copy link
Collaborator

@khiga8 khiga8 commented Feb 18, 2022

Closes https://github.com/github/accessibility/issues/646, #18

Context

title attribute is frequently used though it is inaccessible to many groups of users and hardly useful. This PR introduces a linter rule against it. This rule is implemented as a counter unlike the other rules, though we may consider converting other rules to counters too. This means that if a user wants to disable this rule on a file, they need to disable it with the exact offense count like:

<%# erblint:counter GitHub::Accessibility::FakeCounter 1 %>

instead of

<%# erblint:disable GitHub::Accessibility::FakeLinter %>

The counter implementation is a workaround ported over from dotcom. erb-lint does not natively support granular rule disables so in dotcom we've resorted to a file-level offense implementation and a counter implementation (both of which this library uses too). Having this workaround isn't great.

I've opened a proposal PR to shopify/erb-lint (Shopify/erb_lint#249) with the hopes that we can move away from these workarounds and have disable rule at offense-level like rubocop and eslint allows. Until we have that support, we'll need to work with our workarounds with file-level disable and counters

@khiga8 khiga8 requested review from a team, bolonio and smockle February 18, 2022 02:03
khiga8 added a commit that referenced this pull request Feb 22, 2022
Copy link
Contributor

@lindseywild lindseywild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel comfortable approving because I don't fully understand the ERB linters just yet, but just a few suggestions on the docs -- thanks for doing this 😄

khiga8 and others added 2 commits February 22, 2022 11:31
Co-authored-by: Lindsey Wild <35239154+lindseywild@users.noreply.github.com>
Co-authored-by: Lindsey Wild <35239154+lindseywild@users.noreply.github.com>
Copy link

@bolonio bolonio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From not being an erb expert, it looks good to me, if the tests have been passed, feel free to release and keep an eye on your PR for Shopify.

@khiga8 khiga8 merged commit 4f64ff0 into main Feb 23, 2022
@khiga8 khiga8 deleted the kh-add_no_title_counter branch February 23, 2022 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants